
heights=list(map(int,input().split(",")))

def getResult():
    l=0
    r=len(heights)-1
    maxArea=0
    while l<r:
        x=r-l
        y=0
        if heights[l]<heights[r]:
            y=heights[l]
            l=l+1
        else:
            y=heights[r]
            r=r-1
        maxArea=max(maxArea,x*y)
    return maxArea
print(getResult())